// TOWN DIALOGUE SCRIPT
// 	Town 4: Arena Entrance
//
// Nodes 1-10 are for the Arena Master.

begintalkscript;

variables;
short diff;

// *** Arena Master***
// The Arena Master signs the party up for fights easily, without having to go
// through the level-selecting process in the town script.

begintalknode 1;
	state = -1;
	personality = 2;
	nextstate = 1;
	condition = 1;
	question = "Arena Master";
	text1 = "A merchant in rich garbs sits here and watches you approach. _Yes?_ she says.";
	text5 = "_What else would you like? Business to do, things to kill, you know. I'm a busy woman._";
	action = INTRO;
	
begintalknode 2;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = 1;
	question = "What do you do?";
	text1 = "_I run the Arena here. You can fight monsters in different sorts of combats in the Arena. I've noticed that passing adventurers like to try out their skills sometimes, and the locals pay to watch. Good deal for all._";
	text2 = "_If you'd like to sign up, just tell me what kind of fight you're looking for._";
	text3 = "_I also run the Healing Rune over in the corner. Feel free to use it at any time to restore yourself.";
	
begintalknode 3; // Explanation of this code is above node 4
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) == 0;
	question = "I'd like an easy combat.";
	text1 = "_An easy one, eh?_ She laughs. _Certainly. I can do that. Just proceed east to the Arena, then._";
	text2 = "_Sure. But of course, for a party of your powers, all of the combats will be of equal difficulty._";
	text3 = "_Anything else?_";
	code =
	if (get_flag(4,0) != 250)
		remove_string(2);
	else
		remove_string(1);
	if (get_flag(4,0) % 5 < 3)
		set_flag(4,1,get_flag(4,0) - (get_flag(4,0) % 5));
	else
		set_flag(4,1,get_flag(4,0) + (5 - (get_flag(4,0) % 5)));
	inc_flag(4,1,-5);
	if (get_flag(4,1) == 0)
		set_flag(4,1,1);
break;
	
// Nodes 3-5 contain code that set levels for the combat in the Arena.
// Basically, they round your level to the nearest five (so 36 becomes 35 and 48
// becomes 50, for example), and then they set the level of the combat
// accordingly. An easy combat is five levels below that. A medium combat is
// that level. A hard combat is five levels above that.
begintalknode 4;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) == 0;
	question = "I'd like a medium-difficulty combat.";
	text1 = "_A medium one, eh?_ She nods. _Certainly. I can do that. Just proceed east to the Arena, then._";
	text2 = "_Sure. But of course, for a party of your powers, all of the combats will be of equal difficulty._";
	text3 = "_Anything else?_";
	code =
	if (get_flag(4,0) != 250)
		remove_string(2);
	else
		remove_string(1);
	if (get_flag(4,0) % 5 < 3)
		set_flag(4,1,get_flag(4,0) - (get_flag(4,0) % 5));
	else
		set_flag(4,1,get_flag(4,0) + (5 - (get_flag(4,0) % 5)));
break;

begintalknode 5; // Explanation of this code is above node 4
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) == 0;
	question = "I'd like a tough combat.";
	text1 = "_A tough one, eh?_ She laughs. _Certainly. I can do that. Just proceed east to the Arena, then._";
	text2 = "_Sure. But of course, for a party of your powers, all of the combats will be of equal difficulty._";
	text3 = "_Anything else?_";
	code =
	if (get_flag(4,0) != 250)
		remove_string(2);
	else
		remove_string(1);
	if (get_flag(4,0) % 5 < 3)
		set_flag(4,1,get_flag(4,0) - (get_flag(4,0) % 5));
	else
		set_flag(4,1,get_flag(4,0) + (5 - (get_flag(4,0) % 5)));
	inc_flag(4,1,5);
break;

begintalknode 6;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) > 0;
	question = "By the way, I'd like to make that combat that I signed up for into a range-based combat. Put them on the other side of the pit from me.";
	text1 = "_Sure thing. Done._";
	action = SET_SDF 4 2 1;

begintalknode 7;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) > 0;
	question = "I signed up for a combat, but I changed my mind. I'd rather not fight right now.";
	text1 = "_Okay, then,_ she says. _Your combat has been canceled._";
	code = 
	set_flag(4,1,0);
	set_flag(4,2,0);
break;

begintalknode 8;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,2) > 0;
	question = "I signed up for a range-based combat, but I changed my mind. I'd prefer a melee combat.";
	text1 = "_Fine. The monsters will move appropriately._";
	action = SET_SDF 4 2 0;

begintalknode 9;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = get_flag(4,1) == 0;
	question = "I'd like a specific combat difficulty level.";
	text1 = "_In that case, come and sit in this chair next to me. Sign up for the difficulty level that you'd like._";

begintalknode 10;
	state = 1;
	personality = 2;
	nextstate = 1;
	condition = 1;
	question = "That's all for now.";
	text1 = "_Okay._";
	action = END_TALK;